<?php

class admin_template_system_menu_set_link extends template
{


    public function display()
    {
        $config = bone::get_config('system');
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $this->get_title() . ' - ' . $config->site_name; ?></title>

<script type="text/javascript" language="javascript" src="../js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../js/jquery.cookie.js"></script>

<link type="text/css" rel="stylesheet" href="css/global.css" />
<script type="text/javascript" language="javascript" src="js/global.js"></script>

<link type="text/css" rel="stylesheet" href="apps/system/templates/menu/css/set_link.css" />
<script type="text/javascript" language="javascript" src="apps/system/templates/menu/js/set_link.js"></script>

</head>
<body>

<?php
$apps = $this->get('apps');

foreach($apps as $app)
{
    $links = $app->get_links();
    if(count($links)>0)
    {
        foreach($links as $link)
        {
            //echo ' &nbsp; &nbsp; '.$link->name.' : '.$link->url.' <br />';
            if($link->params==null)
            {
                
            }
        }
    }
}
?>


<div class="stage">

<div id="slider">


<table>
<tr>
    <th>选择应用</th>
    <th>选择链接页面</th>
    <th></th>
    <th>设置参数</th>
</tr>


<tr>
<td width="225">
<div class="apps"><div class="wrap">
    <ul>
    <?php
    foreach($apps as $app)
    {
        $links = $app->get_links();
        if(count($links)>0)
        {
            echo '<li id="app_'.$app->name.'" onclick="javascript:selectApp(\''.$app->name.'\');"><img src="'.$app->icon.'" align="absmiddle" />'.$app->label.' </li>';
        }
    }
    ?>
    </ul>
</div></div>
</td>

<td width="225">
<div class="links">
    <?php
    foreach($apps as $app)
    {
        $links = $app->get_links();
        if(count($links)>0)
        {
           echo '<div id="links_'.$app->name.'">';
           echo '<ul>';
           $i = 0;
           foreach($links as $link)
           {
               echo '<li id="link_'.$app->name.'_'.$i.'" onclick="javascript:selectLink(\''.$app->name.'\', '.$i.');';
               if($link->params!==null) echo 'setParams(\''.$app->name.'\', '.$i.');" class="next';
               echo '">'.$link->name.'</li>';
               $i++;
           }
           echo '</ul>';
           echo '</div>';
        }
    }
    ?>
</div>
</td>

<td width="50" align="center">
	<a href="javascript:;" onclick="javascript:slideBack();" class="slide_back"></a>
</td>

<td width="400">
<div class="params">
    <?php
    foreach($apps as $app)
    {
        $links = $app->get_links();
        if(count($links)>0)
        {
           $i = 0;
           foreach($links as $link)
           {
               if($link->params!==null)
               {
                   echo '<div id="params_'.$app->name.'_'.$i.'">';
                   echo '<ul>';
                   foreach($link->params as $param)
                   {
                       echo $param->label.':<br />';
                       echo '<select name="'.$param->name.'" style="max-width:400px;">';
                       if(count($param->options))
                       {
                           foreach($param->options as $key=>$val)
                           {
                               echo '<option value="'.$key.'">'.$val.'</option>';
                           }
                       }
                       echo '</select><br />';
                   }
                   
                   echo '</ul>';
                   echo '</div>';
               }
               $i++;
           }
           
        }
    }
    ?>
</div>
</td>
</tr>
</table>

</div>
</div>

<div class="toolbar">
	<input id="button_save" disabled="disabled" type="button" value="保存" onclick="javascript:save();" /> 
	<input type="button" value="取消" onclick="javascript:window.close();" /> 
</div>

</body>
</html>
<?php
    }

}
?>